package main

import (
	"sync"
	"time"
)

func main() {
	group := sync.WaitGroup{}
	group.Add(2)
	go func() {
		time.Sleep(time.Second * 2)
		println("1 done")
		group.Add(-1)
	}()
	go func() {
		time.Sleep(time.Second * 3)
		println("2 done")
		group.Done()
	}()
	group.Wait()
	println("done")
}
